﻿Public Class LoaiNhaDAO
    Public Shared Function LoaiNha_Load() As DataTable
        Return DataProvider.LoadTable("Select * from LoaiNha")
    End Function
    Public Shared Sub LoaiNha_Insert(ByVal ln As LoaiNhaDTO)
        ln.MaLoaiNha = AutoInc.AutoIncInt(LoaiNhaDAO.LoaiNha_Load, "MALOAINHA")
        Dim sql As String = String.Format("insert into LOAINHA values({0},'{1}')", ln.MaLoaiNha, ln.Tenloainha)
        DataProvider.ExecuteNonQuery(sql)
    End Sub
    Public Shared Sub LoaiNha_Update(ByVal ln As LoaiNhaDTO)
        Dim sql As String = String.Format("update LOAINHA set TENLOAINHA = '{1}' where MALOAINHA = {0}", ln.MaLoaiNha, ln.Tenloainha)
        DataProvider.ExecuteNonQuery(sql)
    End Sub
    Public Shared Sub LoaiNha_Delete(ByVal ln As LoaiNhaDTO)
        Dim sql As String = String.Format("delete LOAINHA where MALOAINHA = {0}", ln.MaLoaiNha)
        DataProvider.ExecuteNonQuery(sql)
    End Sub
End Class
